home *** CD-ROM | disk | FTP | other *** search
- * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
- * The C++ Answer Book */
- * Tony Hansen */
- * All rights reserved. */
- include <process.h>
- include <debug.h> /* DELETE */
- / pause until one of the objects listed
- / in the vector becomes available.
- nt process::wait(process_object **wv)
-
- if (debug) /*DELETE*/ cerr << "process" << this << "::wait(vec)\n";
- if (mustrecurse())
- return wait(wv);
-
- else
- {
- t_desiredtime = 0;
-
- for (;;)
- {
- // look for object not pending
- for (int i = 0; wv[i] != 0; i++)
- {
- if (!wv[i]->pending())
- {
- // tell everyone to forget us
- for (int j = 0; wv[j] != 0; j++)
- wv[j]->forget(this);
- if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::wait(vec) <- " << i << "\n";
- return i;
- }
-
- wv[i]->remember(this);
- }
-
- if ((i == 0) && (wv[0] == (process_object*)this))
- error("trying to wait for self");
- pause();
- }
- }
-
-